import 'package:json_annotation/json_annotation.dart';

part 'common_http_resp_model.g.dart';

@JsonSerializable(genericArgumentFactories: true)
class CommonHttpRespModel<T> {
  final String? msg;
  final int code;
  final T? data;

  CommonHttpRespModel({
    this.msg,
    required this.code,
    this.data,
  });

  factory CommonHttpRespModel.fromJson(
    Map<String, dynamic> json,
    T Function(dynamic json) fromJsonT,
  ) =>
      _$CommonHttpRespModelFromJson<T>(json, fromJsonT);

  Map<String, dynamic> toJson(Object? Function(T value) toJsonT) =>
      _$CommonHttpRespModelToJson<T>(this, toJsonT);
}
